﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace OA.Mvc3.Controllers
{
    [ValidateInput(false)]
    public class PersonalController : UI.BaseController
    {
        public const string ProgrameCode = "Personal";
        public static readonly string currentPath = UI.Utils.GetCurrentPath(ProgrameCode);

        public PersonalController()
        {
            ViewBag.CurrentPath = currentPath;
        }

        [UI.ValidateAuthority(ProgrameCode , "changepassword")]
        public ViewResult ChangePassword()
        {
            return View();
        }

        [HttpPost]
        [UI.ValidateAuthority(ProgrameCode , "changepassword")]
        public string ChangePassword(string CurrentPassowrd, string NewPassowrd)
        {
            var ret=new BLL.Personal().ChangePassword(CurrentPassowrd, NewPassowrd);
            return UI.Utils.ToJsonString(ret);
        }

        [UI.ValidateAuthority(ProgrameCode , "changeData")]
        public ViewResult ChangeData()
        {
            return View(BLL.LoginUser.LoginManager);
        }

        [HttpPost]
        [UI.ValidateAuthority(ProgrameCode , "changeData")]
        public string ChangeData(Model.Manager model )
        {
            var ret = new BLL.Personal().ChangeData(model);
            return UI.Utils.ToJsonString(ret);
        }
    }
}
